﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using xxx.Candidates.System.Interfaces.IService;
using xxx.Candidates.System.Model.View;

namespace xxx.Candidates.System.Interfaces.Service
{
    public class RandomCandidateService : IRandomCandidateService
    {
        private readonly Random _random = new();

        public IEnumerable<CandidateListVM> GenerateRandomCandidates(int minCount)
        {
            int count = Math.Max(minCount, _random.Next(minCount, minCount + 5));
            return Enumerable.Range(1, count).Select(id => new CandidateListVM()
            {
                ID = id,
                Name = $"L{id - 1}",
                Sex = _random.Next(2) == 0 ? "男" : "女",
                Email = $"user{id}@example.com"
            });
        }
    }
}
